package com.ddyx.service.user.api.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;


/**
 * <p>
 * 		用户信息表
 * </p>
 *
 * @author agula
 * @since 2019-07-11
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("s_user")
public class User extends Model<User> {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
	@TableId(value="id", type= IdType.AUTO)
	private Integer id;
    /**
     * 用户名
     */
	private String name;
	@TableField("role_id")
	private Integer roleId;
    /**
     * 门店编码
     */
	@TableField("store_no")
	private String storeNo;
    /**
     * wx用户Id
     */
	@TableField("wx_uid")
	private String wxUid;
    /**
     * 密码 md5base32
     */
	private String password;
	@TableField("nick_name")
	private String nickName;
    /**
     * 性别 1男性 2女性
     */
	private Integer gender;
    /**
     * 创建时间
     */
	@TableField("create_time")
	private Date createTime;
    /**
     * 更新时间
     */
	@TableField("update_time")
	private Date updateTime;
	@TableField("head_image")
	private String headImage;
    /**
     * 是否可用 1可用  0禁用
     */
	private Integer status;
    /**
     * 备注
     */
	private String remark;

	@TableField(exist = false) //表示该属性不为数据库表字段，但又是必须使用的。
	//@TableField(exist = true) //表示该属性为数据库表字段。
//	@Transient
	private String test;

	@TableField(exist = false)
	private String token;
	@TableField(exist = false)
	private Date loginTime;
	@TableField(exist = false)
	private Date activeTime;

	@Override
	protected Serializable pkVal() {
		return this.id;
	}

	@Override
	public String toString() {
		return "User{" +
			"id=" + id +
			", name=" + name +
			", roleId=" + roleId +
			", storeNo=" + storeNo +
			", wxUid=" + wxUid +
			", password=" + password +
			", nickName=" + nickName +
			", gender=" + gender +
			", createTime=" + createTime +
			", updateTime=" + updateTime +
			", headImage=" + headImage +
			", status=" + status +
			", remark=" + remark +
			"}";
	}
}
